<template>
	<view>
		<view class="search-contaienr">
			<u-search placeholder="搜索商品" :showAction="false" bgColor="#fff" v-model="keyword"></u-search>
		</view>
		<view class="goods-sort">
			<!-- 点击分类切换商品 -->

			<view class="sort-title">
				<view :class="{'sort-item':true, 'active': currentIndex === index}" v-for="(item,index) in 8" :key="index" @tap="switchSort(index)">
					电池类
				</view>
			</view>
			<view class="sort-info">
				<view class="info-item">
					<view class="info-image">
						<image src="https://cdn.uviewui.com/uview/album/1.jpg" mode="aspectFill" style="width: 150rpx;height: 150rpx;"></image>
					</view>
					<view class="info-data">
						<view class="info-title">
							<text>商品名称</text>
						</view>
						<view class="info-specifications">
							<view>
								货号：GTD456774
							</view>
							<view>
								库存：100
							</view>
						</view>
						<view class="info-number">
							<view>
								规格：80*30*0.12
							</view>
							<view>
								单位/对
							</view>
							<view>
								库存120
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentIndex: 0 // 当前选中的菜单索引
			};
		},
		methods:{
			switchSort(index){
				this.currentIndex = index;
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	.active{
		background: #fff;
	}
	.goods-sort {
		display: flex;
		.sort-title{
			display: flex;
			background-color: #F8F8F8;
			height: 100vh;
			flex-direction: column;
			.sort-item {
				height: 80upx;
			width: 150upx;
			display: flex;
			align-items: center;
			justify-content: center;
				font-size: 26upx;
				color: #333;
			}
		}
		.sort-info {
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			.info-item {
				display: flex;
				width: 100%;
				height: 180rpx;
				border-bottom: 1px solid #F4F5F7;
				padding-top: 20rpx;
				padding-left: 10rpx;
				margin-bottom: 20upx;
				background-color: #fff;
				.info-image {
					width: 150upx;
				}
				.info-data {
					padding: 10upx 20upx;
					width: 100%;
					.info-title {
						font-size: 26upx;
						font-weight: 700;
						color: #333;
					}
					.info-specifications {
						display: flex;
						align-items: center;
						justify-content: space-between;
						font-size: 22upx;
						color: #666;
						margin-top: 10upx;
					}
					.info-number {

						display: flex;
						align-items: center;
						justify-content: space-between;
						font-size: 22upx;
						color: #666;
						margin-top: 10upx;
					}
				}
			}
		}
	}
	.search-contaienr {
		padding: 20upx;
		background-color: #F4F5F7;
	}
</style>
